package com.controller;

import com.pojo.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@RestController
public class UserController {

    @Resource
    private RestTemplate restTemplate;

    @GetMapping("/getUserListDemo")
    public List<User> getUserList(){

        User user = new User();
        user.setId(1);
        user.setName("zhangsan");
        List<User> userList = restTemplate.postForObject("http://localhost:8080/getUserList1", user,List.class);

        return userList;
    }
}
